<html>
<head><meta charset="utf-8"><title>bitwise-movable trait to `Copy` · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable.20trait.20to.20.60Copy.60.html">bitwise-movable trait to `Copy`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="151292401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable%20trait%20to%20%60Copy%60/near/151292401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> briansmith <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable.20trait.20to.20.60Copy.60.html#151292401">(Dec 10 2018 at 18:13)</a>:</h4>
<p>Is there any hope for a new supertrait of <code>Copy</code>that means "safe to put in a union, and safe to transmute to an array of bytes, but cannot be implicitly copied?" I have stuff I want to put into unions that are semantically move-only (use-once) resources, and also I need the byte transmute transform and would prefer to be able to have the same restriction (bitwise movable but not implicitly copyable).</p>



<a name="151292554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable%20trait%20to%20%60Copy%60/near/151292554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> briansmith <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable.20trait.20to.20.60Copy.60.html#151292554">(Dec 10 2018 at 18:15)</a>:</h4>
<p>My understanding from the <code>DynSized</code> discussion is that it's very hard to add such types, but the definition of <code>union</code> doesn't make sense without it. In particular, <code>union</code> requires too much use of <code>unsafe</code>; at least all the uses I have for it are completely safe w.r.t. what <code>unsafe</code> is trying to accomplish.</p>



<a name="151404254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable%20trait%20to%20%60Copy%60/near/151404254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/bitwise-movable.20trait.20to.20.60Copy.60.html#151404254">(Dec 10 2018 at 21:53)</a>:</h4>
<p>I don't follow. What would be examples of types that do not have this property?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>